<!--继承了base.html-->
{% extends "blog/base.html" %}
<!--插入头部block-->
{% block title %}My Blog{% endblock %}
<!--插入contentblock-->
{% block content %}
  <h1>My Blog</h1>
  {% for post in posts %}
    <h2>
        <!--获取连接的方式值得参考-->
      <a href="{{ post.get_absolute_url }}">
        {{ post.title }}
      </a>
    </h2>
    <p class="date">
      Published {{ post.publish }} by {{ post.author }}
    </p>
     <!--此处使用了过滤器truncatewords限制在30个字符以内 linebreaks转换换行符未html了换行比较实用-->
    {{ post.body|truncatewords:30|linebreaks }}

  {% endfor %}
    <!--添加分页-->
    {% include "pagination.html" with page=posts %}

{% endblock %}